package com.tek.ding.faceding.presenter.book;

import com.tek.ding.faceding.base.BasePresenter;
import com.tek.ding.faceding.bean.BaseBean;
import com.tek.ding.faceding.network.rx.RxHttpResponseCompat;
import com.tek.ding.faceding.network.rx.observable.ProgressDialogObservable;

import io.reactivex.rxjava3.annotations.NonNull;

public class BookPresenter extends BasePresenter<BookContract.IBookModel, BookContract.BookView> {

    public BookPresenter(BookContract.IBookModel model, BookContract.BookView view) {
        super(model, view);
    }

    public void saveMemberReadBookLog2(String storeUid,String memberUid, String isbn) {
        model.saveMemberReadBookLog2(storeUid, memberUid, isbn)
                .compose(RxHttpResponseCompat.compatResult())
                .subscribe(new ProgressDialogObservable<BaseBean<String>>(context, view) {
                    //不显示提示框
                    @Override
                    protected boolean isShowDialog() {
                        return true;
                    }

                    @Override
                    public void onNext(@NonNull BaseBean<String> baseBean) {
                        if (baseBean != null) {
                            view.saveMemberReadBookLogOk(baseBean);
                        }
                    }
                });
    }
}
